package com.example.xianji.activity;

import android.os.Bundle;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.RelativeLayout;

import com.example.xianji.Contant;
import com.example.xianji.R;
import com.example.xianji.constant.Constant;
import com.example.xianji.utils.sp.PreferenceEngine;

public class Main_Shop_LiuYan_GuanLiActivity extends Activity implements OnClickListener {
    /**
     * 店铺留言管理
     */
    private RelativeLayout relativelayout_my_receive_shop_liuyan, relativelayout_my_shop_liuyan, shop_relative_guanli_back;
//    private SharedPreferences sp;
//    private Editor ed;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        }
        setContentView(R.layout.activity_main__shop__liu_yan);
//        sp = getSharedPreferences("text", MODE_PRIVATE);
//        ed = sp.edit();

        relativelayout_my_receive_shop_liuyan = (RelativeLayout) findViewById(R.id.relativelayout_my_receive_shop_liuyan);
        relativelayout_my_shop_liuyan = (RelativeLayout) findViewById(R.id.relativelayout_my_shop_liuyan);
        shop_relative_guanli_back = (RelativeLayout) findViewById(R.id.shop_relative_guanli_back);
        relativelayout_my_receive_shop_liuyan.setOnClickListener(this);
        relativelayout_my_shop_liuyan.setOnClickListener(this);
        shop_relative_guanli_back.setOnClickListener(this);

        if (PreferenceEngine.getInstance().getString(Constant.SP.NAME, Constant.SP.KEY_XIANJI_TYPE, "").equals("FP") ||
                PreferenceEngine.getInstance().getString(Constant.SP.NAME, Constant.SP.KEY_XIANJI_TYPE, "").equals("AP")) {
            //个人用户
            relativelayout_my_receive_shop_liuyan.setVisibility(View.GONE);
        } else {
            //企业用户
            relativelayout_my_receive_shop_liuyan.setVisibility(View.VISIBLE);
        }
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.shop_relative_guanli_back) {
            Main_Shop_LiuYan_GuanLiActivity.this.finish();
        } else if (v.getId() == R.id.relativelayout_my_shop_liuyan) {
            /**
             * 我的店铺留言(我对企业的留言)
             */
            Intent intent = new Intent(Main_Shop_LiuYan_GuanLiActivity.this, Main_My_product_liuyanActivity.class);
            intent.putExtra("liuyan_comeFrom", Contant.come_from_my_qiye_liuyan);
            startActivity(intent);
        } else if (v.getId() == R.id.relativelayout_my_receive_shop_liuyan) {
            /**
             * 企业账号：我收到店铺的留言
             */
            Intent intent = new Intent(Main_Shop_LiuYan_GuanLiActivity.this, Main_My_product_liuyanActivity.class);
            intent.putExtra("liuyan_comeFrom", Contant.come_from_my_receiver_qiye_liuyan);
            startActivity(intent);
        }
    }
}
